package com.techysky.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.techysky.entity.Marker;
import com.techysky.repository.MarkerRepository;
import com.techysky.service.MarkerService;

/**
 * 
 * @author Administrator
 *
 */
@Service("markerService")
public class MarkerServiceImpl implements MarkerService {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Autowired
	private MarkerRepository markerRepository;

	@Override
	public Marker saveOrUpdate(Marker marker) {
		return this.markerRepository.save(marker);
	}
    
	@Override
	public Marker findById(String id) {
		
		return this.markerRepository.findById(id);
	}

	@Override
	public List<Marker> findByTitleLike(String title) {
		if("".equals(title))
			return this.markerRepository.findAll();
		else
			return this.markerRepository.findByTitleLike(StringUtils.isEmpty(title)?"":title);
	}

}
